package com.xlhj.dynamic.controller;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.xlhj.dynamic.common.ResultData;
import com.xlhj.dynamic.dto.UserReqDto;
import com.xlhj.dynamic.model.SysUserInfo;
import com.xlhj.dynamic.service.SysUserInfoService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author: caijliu
 * @description: UserController
 * @data: 06/08/2021 13:47
 */
@RestController
public class UserController {

    @Autowired
    private SysUserInfoService userInfoService;

    @GetMapping("/getPageUserList")
    public ResultData getPageUserList(UserReqDto reqDto) {
        ResultData resultData = new ResultData();
        try {
            IPage<SysUserInfo> pageUserList = userInfoService.getPageUserList(reqDto);
            if (null != pageUserList) {
                resultData = ResultData.success().object(pageUserList);
            }
        } catch (Exception e) {
            resultData = ResultData.fail().message(e.getCause().toString());
        }
        return resultData;
    }
}
